﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Office.Interop.Excel;

namespace WFL.Office.Excel
{
    public class ExcelBorders : DisposableSite
    {
        public ExcelBorder this[BordersIndex index]
        {
            get
            {
                ExcelBorder item = new ExcelBorder(_borders[(XlBordersIndex)index]);
                Trace(item);
                return item;
            }
        }

        private Borders _borders;

        internal ExcelBorders(Borders borders)
        {
            _borders = borders;
        }

        protected override void Dispose(bool disposing)
        {
            if (_borders != null)
            {
                if (disposing)
                {
                    Marshal.ReleaseComObject(_borders);
                }
                _borders = null;
                base.Dispose(disposing);
            }
        }
    }
}
